home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacTech 1 to 12
/
MacTech-vol-1-12.toast
/
Reference
/
the cmsp digests ('94-'97)
/
csmp digest Vol 3 No 094
< prev
next >
Wrap
Text File
|
1995-04-21
|
77KB
|
2,046 lines
C.S.M.P. Digest Fri, 21 Apr 95 Volume 3 : Issue 94
Today's Topics:
ANNOUNCE: The Mops Page (Programming lang.)
Accessing large arrays
BSP Tree Demo Application and Source
CW's SIOUX don't do the job
Determining if GDevice in color or grayscale mode?
Do games use WaitNextEvent
FYI QuickTime 2.0 Dev Guide for Macintosh on Internet (ftp)
File manipulation??
Macintosh Drag and Drop
No DriverInstall() ???
Saving check boxes?
What are the names of my serial ports? (CTB)
The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
(pottier@clipper.ens.fr).
The digest is a collection of article threads from the internet newsgroup
comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
regularly and want an archive of the discussions. If you don't know what a
newsgroup is, you probably don't have access to it. Ask your systems
administrator(s) for details. If you don't have access to news, you may
still be able to post messages to the group by using a mail server like
anon.penet.fi (mail help@anon.penet.fi for more information).
Each issue of the digest contains one or more sets of articles (called
threads), with each set corresponding to a 'discussion' of a particular
subject. The articles are not edited; all articles included in this digest
are in their original posted form (as received by our news server at
nef.ens.fr). Article threads are not added to the digest until the last
article added to the thread is at least two weeks old (this is to ensure that
the thread is dead before adding it to the digest). Article threads that
consist of only one message are generally not included in the digest.
The digest is officially distributed by two means, by email and ftp.
If you want to receive the digest by mail, send email to listserv@ens.fr
with no subject and one of the following commands as body:
help Sends you a summary of commands
subscribe csmp-digest Your Name Adds you to the mailing list
signoff csmp-digest Removes you from the list
Once you have subscribed, you will automatically receive each new
issue as it is created.
The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
Questions related to the ftp site should be directed to
scott.silver@dartmouth.edu.
-------------------------------------------------------
>From jayfar@netaxs.com (Jay Farrell)
Subject: ANNOUNCE: The Mops Page (Programming lang.)
Date: Mon, 03 Apr 1995 22:49:02 -0400
Organization: Jayfar's Web
Mops 2.5 (Michael's Object-oriented Programming System) is Michael Hore's
powerful programming language/development environment for the Macintosh.
The Mops language is based on Forth by way of Neon, a defunct commercial
Mac product. Mops has added OOP extensions with multiple inheritance and
numerous other enhancements.
Mops doesn't directly compile into PPC code (next version, yes), but comes
w/ a PPC assembler/disassembler so that you can write PPC native modules.
Mops is freeware and in the public domain.
To ftp Mops 2.5 and find valuable Mops resources for novice to advanced
programmers, see The Mops Page:
http://www.netaxs.com/~jayfar/mops.html
*** Just Added: The Mops FAQ - April '95 ***
Jayfar
- -------------------------------------------------------------------
Jay Farrell <URL:http://www.netaxs.com/~jayfar/>
jayfar@netaxs.com
Philadelphia, Pennsylvania, U.S.A.
- -------------------------------------------------------------------
"Wonder How A Po' M*ther F*cker Feel"
-- Joshua Jordan (1920-1993)
---------------------------
>From wuttke@stein.teuto.de (Manfred Wuttke)
Subject: Accessing large arrays
Date: Mon, 03 Apr 1995 17:01:35 +0200
Organization: -
Hello!
Please take a look on this code:
PROGRAM TestLArray;
TYPE
LongArray = PACKED ARRAY[0..0] OF LongInt;
LArrayPtr = ^LongArray;
VAR
p: Ptr;
l: LongInt;
BEGIN
DebugStr('start');
p := NewPtr(60000);
FOR l := 0 TO (60000 DIV 4) - 1 DO
LArrayPtr(p)^[l] := $FFFF;
DisposePtr(p);
END.
It crashes on my PowerMacintosh 6100. I use THINK Pascal 4.0.2 and System
7.5. All compiler options are turned off. The program works if the array is
smaller than 32K. Does anybody know why this little program crashes?
Thank you,
-Matthias (wuttke@stein.teuto.de)
+++++++++++++++++++++++++++
>From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
Date: Tue, 4 Apr 1995 13:51:42 +1200 (NZDT)
Organization: (none)
wuttke@stein.teuto.de (Manfred Wuttke) writes:
> Hello!
>
> Please take a look on this code:
>
> PROGRAM TestLArray;
>
> TYPE
> LongArray = PACKED ARRAY[0..0] OF LongInt;
> LArrayPtr = ^LongArray;
>
> VAR
> p: Ptr;
> l: LongInt;
>
> BEGIN
> DebugStr('start');
> p := NewPtr(60000);
> FOR l := 0 TO (60000 DIV 4) - 1 DO
> LArrayPtr(p)^[l] := $FFFF;
> DisposePtr(p);
> END.
>
> It crashes on my PowerMacintosh 6100. I use THINK Pascal 4.0.2 and System
> 7.5. All compiler options are turned off. The program works if the array is
> smaller than 32K. Does anybody know why this little program crashes?
It crashes because THINK Pascal is using a 16x16->16 multiply for the
array indexing calculation.
I really don't know why they do this because even the original 68000 multiply
is a 16x16->32 calculation, which would work fine for a LongArray up to 128K or
256K in size (depending on whether they used signed or unsigned), and would in
general work for any array where there wre fewer than 32K (or 64K) elements,
each of up to 32K or 64K in size.
What you'll need to do (since bitching to Symantec about this long since ceased
to be useful) is to declare the array to have more than 32K elements, thus
forcing the compiler to use a 32x32 multiply.
TYPE
LongArray = PACKED ARRAY[0..maxlongint] OF LongInt;
-- Bruce
---------------------------
>From bwade@graphics.cornell.edu (Bretton Wade)
Subject: BSP Tree Demo Application and Source
Date: Thu, 06 Apr 1995 04:05:12 -0400
Organization: Cornell Program of Computer Graphics
I have placed a demonstration application for Binary Space Partitioning
(BSP) Trees at the URL:
ftp://ray.graphics.cornell.edu/pub/bsptree/BSP_Tree_Demo_1.0.sea.hqx
This distribution includes a "fat" application for Apple Macintosh
computers, and all the source code used to build it in Metrowerks
CodeWarrior 5.5 format.
The Distribution contains pointers to the BSP Tree FAQ should you like to
know more.
--
Bretton Wade (bwade@graphics.cornell.edu)
http://www.graphics.cornell.edu/~bwade/
---------------------------
>From gagne@phy.ulaval.ca (Philippe Gagne)
Subject: CW's SIOUX don't do the job
Date: Thu, 30 Mar 1995 16:48:56 GMT
Organization: COPL, Universite Laval, Qc, Canada
I recently bought CodeWarior 5.0 and I want to port to it all my little
programs I wrote in ThinkC. CW seems good but the console package (SIOUX)
does not looks very professional. Is there some alternatives?
- -
========================================================================
| Philippe Gagne | "If you understand what you're doing, |
| COPL, Universite Laval | you're not learning anything." |
| Quebec, Canada | -- A. L. |
| gagne@phy.ulaval.ca | |
========================================================================
+++++++++++++++++++++++++++
>From catambay@aol.com (Bill the Cat)
Date: Thu, 30 Mar 1995 13:30:53 -0800
Organization: Starfleet Academy
In article <D69IpL.3q3@athena.ulaval.ca>, gagne@phy.ulaval.ca wrote:
-> I recently bought CodeWarior 5.0 and I want to port to it all my little
-> programs I wrote in ThinkC. CW seems good but the console package (SIOUX)
-> does not looks very professional. Is there some alternatives?
->
->
-> ---
-> ========================================================================
-> | Philippe Gagne | "If you understand what you're doing, |
-> | COPL, Universite Laval | you're not learning anything." |
-> | Quebec, Canada | -- A. L. |
-> | gagne@phy.ulaval.ca | |
-> ========================================================================
->
->
You can write your own package. I believe the source for Sioux comes with CW.
_____________________________________________________________________
Bill Catambay
Pascal Programmer on Macintosh and Open VMS
/>
// The purpose of software engineering
(//////[O]>=========================================-
\\ is to manage complexity, not to create it.
\>
____________________________________________________________________
+++++++++++++++++++++++++++
>From ourx124@deere.com (Juan Ingles)
Date: Fri, 31 Mar 1995 01:31:50 GMT
Organization: Proteus Ventures, Inc.
In article <D69IpL.3q3@athena.ulaval.ca>, gagne@phy.ulaval.ca wrote:
> I recently bought CodeWarior 5.0 and I want to port to it all my little
> programs I wrote in ThinkC. CW seems good but the console package (SIOUX)
> does not looks very professional. Is there some alternatives?
[snip]
( can't resist... )
[begin rhetorical question w/soapbox overtones]
Just what is your definition of "professional looking" when it comes to
putting a console interface on Macintosh program?
;)
[end rhetorical question]
You can customize the CodeWarrior SIOUX package to a slight degree. You
can get rid of the status display, change the font, get rid of the menus,
get rid of the "Save changes" dialog, and a few other other things. Look
in the SIOUX.h file for a complete list of the settings and instructions
on how to do this.
If that doesn't do it for you, you can write your own console package and
substitute it for SIOUX. I believe instructions (hints anyway) for doing
that are in SIOUX.h and console.stubs.c.
I heard someone say (Avi Rappoport maybe?) that they were going to
document the SIOUX package better in the future. Maybe they'll do it for
CW 6.
Juan.
+++++++++++++++++++++++++++
>From gagne@phy.ulaval.ca (Philippe Gagne)
Date: Fri, 31 Mar 1995 17:10:41 GMT
Organization: COPL, Universite Laval, Qc, Canada
>In article <D69IpL.3q3@athena.ulaval.ca>, gagne@phy.ulaval.ca wrote:
>
>> I recently bought CodeWarior 5.0 and I want to port to it all my little
>> programs I wrote in ThinkC. CW seems good but the console package (SIOUX)
>> does not looks very professional. Is there some alternatives?
>[snip]
>
>( can't resist... )
>
>[begin rhetorical question w/soapbox overtones]
>Just what is your definition of "professional looking" when it comes to
>putting a console interface on Macintosh program?
>;)
>[end rhetorical question]
>
I always liked philosophy, so I'll explain my definition of a good console
interface.
All day long I work on a Sun workstation, hoping to finish my PhD someday.
When the night comes, I go home and tries to forget my working day by
trying the same simulation on my Macintosh.
To me, a good console package would simulate an openwin cmdtool. SIOUX has
the scrollbars (that's good), but the writing to it seems very slow (when
you printf something you have the feeling of a 2400 bauds terminal). I
hate the status display.
In ThinkC there was a way to have a pop-up command-line interface. Is there
something equivalent in SIOUX?
> You can customize the CodeWarrior SIOUX package to a slight degree. You
> can get rid of the status display, change the font, get rid of the menus,
> get rid of the "Save changes" dialog, and a few other other things. Look
> in the SIOUX.h file for a complete list of the settings and instructions
> on how to do this.
So i will look at that hoping it is not too complicated.
- -
========================================================================
| Philippe Gagne | "If you understand what you're doing, |
| COPL, Universite Laval | you're not learning anything." |
| Quebec, Canada | -- A. L. |
| gagne@phy.ulaval.ca | |
========================================================================
+++++++++++++++++++++++++++
>From mwron@aol.com (MW Ron)
Date: 30 Mar 1995 21:48:27 -0500
Organization: America Online, Inc. (1-800-827-6364)
gagne@phy.ulaval.ca (Philippe Gagne) Writes:
>I recently bought CodeWarior 5.0 and I want to port to it all my little
>programs I wrote in ThinkC. CW seems good but the console package (SIOUX)
>does not looks very professional.
Hi Philippe, You can modify the look of the SIOUX interface some useing
the structure in the SIOUX.H file by setting them in your main file
SIOUXSettings.tabspaces = 4 for example. It might make a differece. It
is constantly improving in robustness and in ease of use.
Ron
METROWERKS Ron Liechty
"Software at Work" MWRon@metrowerks.com
METROWERKS Ron Liechty
"Software at Work" MWRon@metrowerks.com
+++++++++++++++++++++++++++
>From catambay@aol.com (Bill the Cat)
Date: Fri, 31 Mar 1995 13:44:26 -0800
Organization: Starfleet Academy
->
-> I heard someone say (Avi Rappoport maybe?) that they were going to
-> document the SIOUX package better in the future. Maybe they'll do it for
-> CW 6.
->
That would be most excellent. :)
_____________________________________________________________________
Bill Catambay
Pascal Programmer on Macintosh and Open VMS
/>
// The purpose of software engineering
(//////[O]>=========================================-
\\ is to manage complexity, not to create it.
\>
____________________________________________________________________
+++++++++++++++++++++++++++
>From mwron@aol.com (MW Ron)
Date: 31 Mar 1995 14:45:29 -0500
Organization: America Online, Inc. (1-800-827-6364)
ourx124@deere.com (Juan Ingles) Writes:
>I heard someone say (Avi Rappoport maybe?) that they were going to
>document the SIOUX package better in the future. Maybe they'll do it for
>CW 6.
Yes this should be done in CW6.
METROWERKS Ron Liechty
"Software at Work" MWRon@metrowerks.com
+++++++++++++++++++++++++++
>From ourx124@deere.com (Juan Ingles)
Date: Sat, 1 Apr 1995 02:32:53 GMT
Organization: Proteus Ventures, Inc.
In article <D6BEDv.EH1@athena.ulaval.ca>, gagne@phy.ulaval.ca wrote:
[snip]
>
> All day long I work on a Sun workstation, hoping to finish my PhD someday.
> When the night comes, I go home and tries to forget my working day by
> trying the same simulation on my Macintosh.
>
I was asking rhetorically because I figured that you had a good excuse.
Sounds good enough for me. BTW, beer helps with the forgetting part ;)
[snip]
> To me, a good console package would simulate an openwin cmdtool. SIOUX has
> the scrollbars (that's good), but the writing to it seems very slow (when
> you printf something you have the feeling of a 2400 bauds terminal).
There used to be a function that changed the buffer mode for SIOUX that
greatly improved the performance. I do not know what it is off-hand.
Anybody out there know? Ron?
> I hate the status display.
try:
tSIOUXSettings mySIOUXSettings =
{TRUE,TRUE,FALSE,TRUE,FALSE,0,0,80,24,0,0,monaco,9,normal};
SIOUXSettings = mySIOUXSettings;
This should be done before your first write to the console.
[snip]
> In ThinkC there was a way to have a pop-up command-line interface. Is there
> something equivalent in SIOUX?
argc = ccommand(&argv);
lets you type in arguments or redirect with files. Don't forget to
#include <console.h>
You might also think about creating mpw tools instead of applications.
That would give you a command line interface and redirection to your
heart's content. The only drawback is that currently you can't create PPC
tools.
Juan.
--
ourx124@deere.com (Juan Ingles)
+++++++++++++++++++++++++++
>From THUNDERONE@news.delphi.com (THUNDERONE@DELPHI.COM)
Date: 1 Apr 1995 21:42:27 -0500
Organization: Delphi Internet Services Corporation
catambay@aol.com (Bill the Cat) writes:
>In article <D69IpL.3q3@athena.ulaval.ca>, gagne@phy.ulaval.ca wrote:
>-> I recently bought CodeWarior 5.0 and I want to port to it all my little
>-> programs I wrote in ThinkC. CW seems good but the console package (SIOUX)
>-> does not looks very professional. Is there some alternatives?
>->
>->
>You can write your own package. I believe the source for Sioux comes with CW.
You can write your own package, but the source is _not_ available.
________________.______.._____...___....._.....................
Chris Thomas, thunderone@delphi.com, friend of the devil
" *** you have missed the point entirely *** "
+++++++++++++++++++++++++++
>From rossb@klang.latrobe.edu.au (Ross Bencina)
Date: Tue, 4 Apr 1995 04:19:25 GMT
Organization: La Trobe University
My problem with SIOUX (and the Think console) is that there is no way (as
far as I know) of setting up an event loop to process AppleEvents. I have
ported a number of tools from Unix, and replaced their shell interface
with AppleScript support, in one case I replaced an embedded scripting
language with apple script hooks (including runtime aete generation).
I found CW's ANSI stubs incredibly useful, but I had to write a new
console interface (OK, not rocket science) to get it working. EventManager
hooks in SIOUX would be a really cool thing!
Ross B.
+++++++++++++++++++++++++++
>From dirk@gaga.maschinenbau.uni-dortmund.de (Dirk Froehling)
Date: Wed, 05 Apr 1995 15:46:56 +0200
Organization: UniDO
In article <1995Apr4.041925.39@lugb.latrobe.edu.au>,
rossb@klang.latrobe.edu.au (Ross Bencina) wrote:
> My problem with SIOUX (and the Think console) is that there is no way (as
> far as I know) of setting up an event loop to process AppleEvents. I have
> ported a number of tools from Unix, and replaced their shell interface
> with AppleScript support, in one case I replaced an embedded scripting
> language with apple script hooks (including runtime aete generation).
Why didn't you try this (copied from SIOUX.h):
/*
* extern void SIOUXHandleOneEvent(EventRecord *initialevent);
*
* Tells SIOUX to handle one event. If initialevent is NULL, then SIOUX
* will poll the eventqueue for an event. For applications which wish to
* use an embedded SIOUX window, call this function at the beginning of
* your eventloop, and pass it your current event ...
*
* EventRecord *userevent: The user's event from their call to
Get/WaitNextEvent.
* returns Boolean: Was the event handled by SIOUX?
*/
extern Boolean SIOUXHandleOneEvent(EventRecord *userevent);
If you need to handle the SIOUX menus too, you can find the function names
in the link map.
--
| Dirk Froehling - Germany, Uni Dortmund, FB Maschinenbau, LS Mechanik |
| dirk@gaga.maschinenbau.uni-dortmund.de GEnie: D.FROEHLING |
---------------------------
>From winter@ai.rl.af.mil (Jim Wintermyre)
Subject: Determining if GDevice in color or grayscale mode?
Date: Mon, 3 Apr 1995 23:43:42 GMT
Organization: Rome Laboratory
Does anyone know of a simple way to determine if a given indexed
GDevice is in color or grayscale mode? I tried the tip in the April
'93 MacTech, but that only tells you whether you're in color/grayscale
mode or *black and white* - it can't tell the difference between, say,
8-bit grayscale and 8-bit color.
Thanks,
Jim
winter@ai.rl.af.mil
wintermyrej@rl.af.mil
+++++++++++++++++++++++++++
>From ldo@waikato.ac.nz (Lawrence D9Oliveiro)
Date: Wed, 05 Apr 1995 17:05:52 +1200
Organization: University of Waikato
In article <1995Apr3.234342.4430@news.rlcn.rl.af.mil>, winter@ai.rl.af.mil
(Jim Wintermyre) wrote:
>Does anyone know of a simple way to determine if a given indexed
>GDevice is in color or grayscale mode?
TestDeviceAttribute(TheDevice, gdDevType)
is supposed to return true for colour, false for greyscale.
---------------------------
>From rondavis@gateway.datawatch.com (Ron Davis)
Subject: Do games use WaitNextEvent
Date: Fri, 10 Mar 1995 16:35:06 -0400
Organization: Datawatch Corp
I am currently playing with the Spriteworld examples and have taken the
Simple Break Out code and added an event loop and menus etc. The problem
is I call WaitNextEvent in this loop and that drags the program to a
crawl, unless I set the sleep time to 0. Even at 1 it is too slow. At 0
I am being very MacRude.
So my question is: Do Mac arcade style games call WaitNextEvent? If not
what do they do?
__________________________________________________________________
"I want to know God's thoughts...the rest are details."
-- Albert Einstein
_________________________________________
Ron Davis Software Engineer rondavis@datawatch.com
Finger rdavis@server0.cybernetics.net for PGP key.
http://www.cybernetics.net/users/rdavis/RDHomePage.html
Opinions are MINE - Datawatch doesn't pay me enough to own my opinions.
+++++++++++++++++++++++++++
>From first.ascent@mindlink.bc.ca (Alex Curylo)
Date: 11 Mar 1995 04:44:33 GMT
Organization: First Ascent
In article <3jqrqm$e84@kernighan.cs.umass.edu>
jgrass@cs.umass.edu (Joshua Grass) writes:
> The truth is that WaitNextEvent
> just goes into too much code to be able to implement and have a fast game.
Not necessarily true -- if there's an event pending for your
application, WNE returns it quickly enough to keep things moving along
nicely.
Therefore, always post a private event to yourself immediately before
calling WNE. (And delete it afterwards, if WNE returned a different
event!) This was quite sufficient to achieve acceptable frame rates
with that fine, fine ZipZapMap! series, for instance.
Alex Curylo first.ascent@mindlink.bc.ca (604)451-5323, fax -1359
*** First Ascent: Mac programming, UP paragliders, indie CDs ***
+++++++++++++++++++++++++++
>From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
Date: Sat, 11 Mar 1995 18:14:58 +1300 (NZDT)
Organization: (none)
rondavis@gateway.datawatch.com (Ron Davis) writes:
> I am currently playing with the Spriteworld examples and have taken the
> Simple Break Out code and added an event loop and menus etc. The problem
> is I call WaitNextEvent in this loop and that drags the program to a
> crawl, unless I set the sleep time to 0. Even at 1 it is too slow. At 0
> I am being very MacRude.
>
> So my question is: Do Mac arcade style games call WaitNextEvent? If not
> what do they do?
Don't call it every time around the loop. Check TickCount() and only call
WaitNextEvent if at least 10 or 15 ticks have passed since the last time you
called it. And use a sleep time of zero.
+++++++++++++++++++++++++++
>From dwareing@apanix.apana.org.au (David Wareing)
Date: 14 Mar 1995 19:15:45 GMT
Organization: Apanix Public Access Unix, +61 8 373 5485 (5 lines)
rondavis@gateway.datawatch.com (Ron Davis) writes:
>I am currently playing with the Spriteworld examples and have taken the
>Simple Break Out code and added an event loop and menus etc. The problem
>is I call WaitNextEvent in this loop and that drags the program to a
>crawl, unless I set the sleep time to 0. Even at 1 it is too slow. At 0
>I am being very MacRude.
>So my question is: Do Mac arcade style games call WaitNextEvent? If not
>what do they do?
Someone is going to flame me, but don't bother with WNE for an *arcade*
game. Check the mouse and keyboard directly (GetKeys) and keep
things tight within your main loop by not caring less about anything
else that's happening to the system. Such games often need to take
over the whole shebang for performance reasons. If someone wants
to play an arcade game well they're just going to have to finish
that modem transfer first. Life's like that. At least until we
get a new OS.
However, if speed is not a major issue (say you're writing a
strategy or board game) then the usual event handling rigmorole
should be used.
--
David Wareing dwareing@apanix.apana.org.au
Adelaide, South Australia
Macintosh Games & Multimedia Programming
- ------------------------------------------------------------
May you live in interesting times
+++++++++++++++++++++++++++
>From fdj@muc.de (Florian -FDj- Dejako)
Date: Wed, 15 Mar 1995 00:10:27 +0100
Organization: None. None at all!
In article <3k4q11$59t@tipellium.apana.org.au>,
dwareing@apanix.apana.org.au (David Wareing) wrote:
> rondavis@gateway.datawatch.com (Ron Davis) writes:
>
> >I am currently playing with the Spriteworld examples and have taken the
> >Simple Break Out code and added an event loop and menus etc. The problem
> >is I call WaitNextEvent in this loop and that drags the program to a
> >crawl, unless I set the sleep time to 0. Even at 1 it is too slow. At 0
> >I am being very MacRude.
>
> >So my question is: Do Mac arcade style games call WaitNextEvent? If not
> >what do they do?
If you want to be Mac-friendly you'll have it two ways:
a) The user selects "No background operations" in a menu. Then you don't bother
about WNE.
b) The user wants their Mac to perform some jobs in the background and they
told you that through that same menu item. You'll want to implement some-
thing known as "WNE Smarts" then:
in your main event loop it looks like: (from scratch)
long theBusyTime = GetCaretTime();
long theNextTimeWNE = GetTickCount() + theBusyTime;
while (!gDone) {
PerformAction(); // do your busy tasks here, like display the next frame
if (GetTickCount() > theNextTimeWNE) {
GetNextEvent(...); // didn't we want to use WaitNextEvent here? however
DoEvent(theEvent);
theNextTimeWNE = GetTickCount() + theBusyTime;
}
}
// this way you at least don't miss any important Mac-events... enjoy.
- ------------------------------------------------------------------
- - Florian Dejako -- fdj@muc.de -- Macintosh! -- FDj on #macdev ---
- ------------------------------------------------------------------
+++++++++++++++++++++++++++
>From peter@mail.peter.com.au (Peter N Lewis)
Date: Thu, 16 Mar 1995 13:31:24 +0800
Organization: Curtin University
In article <3k4q11$59t@tipellium.apana.org.au>,
dwareing@apanix.apana.org.au (David Wareing) wrote:
>Someone is going to flame me, but don't bother with WNE for an *arcade*
>game. Check the mouse and keyboard directly (GetKeys) and keep
>things tight within your main loop by not caring less about anything
>else that's happening to the system. Such games often need to take
>over the whole shebang for performance reasons. If someone wants
>to play an arcade game well they're just going to have to finish
>that modem transfer first. Life's like that. At least until we
>get a new OS.
Says who? I've played marathon with Anarchie downloading in the
background. It kept the modem flat out at 14k4 speeds with out any change
in Marathon's performance. All it requires is for people to program
well. You're right, if people program badly, then the current OS wont
function well. If you think some future OS will make up for people
programming badly, then I've got some ocean side land in Alice Springs to
sell you...
There is no single anser to "Do games use WaitNextEvent?". It depends on
the game. If you want an arcade game, then probably the best bet is to
not call WNE except between levels or during Pauses. Another option is to
call GNE instead of WNE. Another option is to post and event to yourself
and then call WNE which speeds up the return time. Another option is to
call WNE only if there is a pending event. Another option is to call WNE
infrequently (once every 15 or 30 ticks).
Now, games aside, here is some specifc advice about WNE:
Always use a sleep time of zero if you are actively doing something
(downloading, decoding, creating mandlebrots, whatever).
Call WNE as frequently as you can, but not so frequently that it degrades
performance. Call it more frequently if you are in the background (at
least once a tick or two), and less frquently if you are in the foreground
(up to once ever 5 ticks (more for arcade style use)).
Obviously, if you're idle, then call it as frequently as possible, with a
noticable sleep time (60 ticks or more if you don't get any non-event
action, 5-15 ticks if you can get events from other than the event loop
(eg connection events on a TCP stream or whatever)).
Enjoy,
Peter.
--
The best movie I've seen recently is "Heavenly Creatures" from New Zealand
+++++++++++++++++++++++++++
>From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
Date: Fri, 17 Mar 1995 15:00:47 +1300 (NZDT)
Organization: (none)
peter@mail.peter.com.au (Peter N Lewis) writes:
> >Someone is going to flame me, but don't bother with WNE for an *arcade*
> >game. Check the mouse and keyboard directly (GetKeys) and keep
> >things tight within your main loop by not caring less about anything
> >else that's happening to the system. Such games often need to take
> >over the whole shebang for performance reasons. If someone wants
> >to play an arcade game well they're just going to have to finish
> >that modem transfer first. Life's like that. At least until we
> >get a new OS.
>
> Says who? I've played marathon with Anarchie downloading in the
> background. It kept the modem flat out at 14k4 speeds with out any change
> in Marathon's performance. All it requires is for people to program
> well.
I guess we won't mention that the clever programmer of Anarchie wrote it
using chained completion procs (or at least I assume that's what you did)
so as to not *need* other people to call WaitNextEvent... :-)
-- Bruce
+++++++++++++++++++++++++++
>From ingemar@lysator.liu.se (Ingemar Ragnemalm)
Date: 17 Mar 1995 10:10:03 GMT
Organization: (none)
rondavis@gateway.datawatch.com (Ron Davis) writes:
>So my question is: Do Mac arcade style games call WaitNextEvent? If not
>what do they do?
I usually don't call WNE in my game loops, except if the user demands it
by turning the "allow background tasks" switch on (which I usually provide).
However, when the game is paused, I certainly call WNE.
--
- -
Ingemar Ragnemalm, PhD
Image processing, Mac shareware games
E-mail address: ingemar@isy.liu.se or ingemar@lysator.liu.se
+++++++++++++++++++++++++++
>From peter@mail.peter.com.au (Peter N Lewis)
Date: Thu, 16 Mar 1995 13:31:24 +0800
Organization: Curtin University
In article <3k4q11$59t@tipellium.apana.org.au>,
dwareing@apanix.apana.org.au (David Wareing) wrote:
>Someone is going to flame me, but don't bother with WNE for an *arcade*
>game. Check the mouse and keyboard directly (GetKeys) and keep
>things tight within your main loop by not caring less about anything
>else that's happening to the system. Such games often need to take
>over the whole shebang for performance reasons. If someone wants
>to play an arcade game well they're just going to have to finish
>that modem transfer first. Life's like that. At least until we
>get a new OS.
Says who? I've played marathon with Anarchie downloading in the
background. It kept the modem flat out at 14k4 speeds with out any change
in Marathon's performance. All it requires is for people to program
well. You're right, if people program badly, then the current OS wont
function well. If you think some future OS will make up for people
programming badly, then I've got some ocean side land in Alice Springs to
sell you...
There is no single anser to "Do games use WaitNextEvent?". It depends on
the game. If you want an arcade game, then probably the best bet is to
not call WNE except between levels or during Pauses. Another option is to
call GNE instead of WNE. Another option is to post and event to yourself
and then call WNE which speeds up the return time. Another option is to
call WNE only if there is a pending event. Another option is to call WNE
infrequently (once every 15 or 30 ticks).
Now, games aside, here is some specifc advice about WNE:
Always use a sleep time of zero if you are actively doing something
(downloading, decoding, creating mandlebrots, whatever).
Call WNE as frequently as you can, but not so frequently that it degrades
performance. Call it more frequently if you are in the background (at
least once a tick or two), and less frquently if you are in the foreground
(up to once ever 5 ticks (more for arcade style use)).
Obviously, if you're idle, then call it as frequently as possible, with a
noticable sleep time (60 ticks or more if you don't get any non-event
action, 5-15 ticks if you can get events from other than the event loop
(eg connection events on a TCP stream or whatever)).
Enjoy,
Peter.
--
The best movie I've seen recently is "Heavenly Creatures" from New Zealand
+++++++++++++++++++++++++++
>From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
Date: Fri, 17 Mar 1995 15:00:47 +1300 (NZDT)
Organization: (none)
peter@mail.peter.com.au (Peter N Lewis) writes:
> >Someone is going to flame me, but don't bother with WNE for an *arcade*
> >game. Check the mouse and keyboard directly (GetKeys) and keep
> >things tight within your main loop by not caring less about anything
> >else that's happening to the system. Such games often need to take
> >over the whole shebang for performance reasons. If someone wants
> >to play an arcade game well they're just going to have to finish
> >that modem transfer first. Life's like that. At least until we
> >get a new OS.
>
> Says who? I've played marathon with Anarchie downloading in the
> background. It kept the modem flat out at 14k4 speeds with out any change
> in Marathon's performance. All it requires is for people to program
> well.
I guess we won't mention that the clever programmer of Anarchie wrote it
using chained completion procs (or at least I assume that's what you did)
so as to not *need* other people to call WaitNextEvent... :-)
-- Bruce
+++++++++++++++++++++++++++
>From ingemar@lysator.liu.se (Ingemar Ragnemalm)
Date: 17 Mar 1995 10:10:03 GMT
Organization: (none)
rondavis@gateway.datawatch.com (Ron Davis) writes:
>So my question is: Do Mac arcade style games call WaitNextEvent? If not
>what do they do?
I usually don't call WNE in my game loops, except if the user demands it
by turning the "allow background tasks" switch on (which I usually provide).
However, when the game is paused, I certainly call WNE.
--
- -
Ingemar Ragnemalm, PhD
Image processing, Mac shareware games
E-mail address: ingemar@isy.liu.se or ingemar@lysator.liu.se
+++++++++++++++++++++++++++
>From cconstan@airux1.env.gov.bc.ca (Carl B. Constantine)
Date: Fri, 17 Mar 1995 07:52:49 -0700
Organization: Ministry of Environment, Lands & Parks
In article <peter-1603951331240001@rocky.curtin.edu.au>,
peter@mail.peter.com.au (Peter N Lewis) wrote:
> Now, games aside, here is some specifc advice about WNE:
>
> Always use a sleep time of zero if you are actively doing something
> (downloading, decoding, creating mandlebrots, whatever).
>
> Call WNE as frequently as you can, but not so frequently that it degrades
> performance. Call it more frequently if you are in the background (at
> least once a tick or two), and less frquently if you are in the foreground
> (up to once ever 5 ticks (more for arcade style use)).
>
> Obviously, if you're idle, then call it as frequently as possible, with a
> noticable sleep time (60 ticks or more if you don't get any non-event
> action, 5-15 ticks if you can get events from other than the event loop
> (eg connection events on a TCP stream or whatever)).
>
Ok, I'll bite. How do you know when to call it in these situations (ie: 5
or 15 or 60 ticks, etc). Generally speaking a program is set up such that
it calls WNE in the main loop, processes it and comes back and calls it
again. How do you know how many ticks have gone by the next time WNE is
called?
--
========================================================================
Carl B. Constantine B.C. Environment, Lands & Parks
Systems Officer CCONSTAN@airux1.env.gov.bc.ca
"Remember, no matter where you go - there you are" - Buckaroo Bonzai
+++++++++++++++++++++++++++
>From msmwhq01.rharve01@eds.com (Richard Harvey)
Date: 20 Mar 1995 16:10:53 GMT
Organization: EDS Corporate Info. Systems
In article <cconstan-1703950752490001@epdso1.env.gov.bc.ca>
cconstan@airux1.env.gov.bc.ca (Carl B. Constantine) writes:
> Ok, I'll bite. How do you know when to call it in these situations (ie: 5
> or 15 or 60 ticks, etc). Generally speaking a program is set up such that
> it calls WNE in the main loop, processes it and comes back and calls it
> again. How do you know how many ticks have gone by the next time WNE is
> called?
Well, I'd recommend setting up a Time Manager task that is called at
whatever interval you need to call WNE at. You can then have it set a
global Boolean that you can check in your main loop to see if it is
time to call WNE. If it is, set it back to false and wait for the next
pass.
-- Rich
**********************************************************************
** Richard Harvey "We are the music makers; **
** ASE - Electronic Data Systems (EDS) We are the dreamers of **
** Corporate Information Systems the dream..." **
** -- Willy Wonka **
** **
** msmwhq01.rharve01@eds.com **
**********************************************************************
+++++++++++++++++++++++++++
>From phixus@deltanet.com (Chris De Salvo)
Date: Mon, 20 Mar 1995 21:55:17 -0800
Organization: MacPlay
In article <3kk9ed$l34@maverick.tad.eds.com>, msmwhq01.rharve01@eds.com
(Richard Harvey) wrote:
> In article <cconstan-1703950752490001@epdso1.env.gov.bc.ca>
> cconstan@airux1.env.gov.bc.ca (Carl B. Constantine) writes:
>
> > Ok, I'll bite. How do you know when to call it in these situations (ie: 5
> > or 15 or 60 ticks, etc). Generally speaking a program is set up such that
> > it calls WNE in the main loop, processes it and comes back and calls it
> > again. How do you know how many ticks have gone by the next time WNE is
> > called?
>
> Well, I'd recommend setting up a Time Manager task that is called at
> whatever interval you need to call WNE at. You can then have it set a
> global Boolean that you can check in your main loop to see if it is
> time to call WNE. If it is, set it back to false and wait for the next
> pass.
Depends on the game. If you're writing a bridge game, or checkers, by all
means, use a normal event loop. If you're writing a
massively-speed-critical arcade thriller then screw the event loop. Take
over the whole machine. Read the mouse directly, read the keyboard
directly, ignore all other applications. you're a game, you're allowed.
If you do use an event loop then Apple recommends check the double-click
time with GetDoubleTime and calling WNE at least that often. One thing
that a lot of people do is to use GetOSEvent the majority of the time for
speed's sake and then call WNE about every 60th of a second for
friendliness' sake. GetOSEvent will let you have a crack at keyboard and
mouse events before the rest of the system. Save a lot of time.
This is also a common thing to do in PowerPC games since WNE is still
emulated. By lowering the number of WNE calls you remove a ton of context
switches and still keep a pretty peppy user-responsiveness.
L8R
Chris
--
+-----------------------------------------------------------------+
| phixus@deltanet.com | Macintosh: Changing the world, |
| Chris De Salvo | one person at a time! |
| Professional Mac Geek | ----------------------------- |
| for MacPlay, Inc. | (I wish they'd hurry up!) |
+-----------------------------------------------------------------+
Any opinions expressed, or implied, are my own! They should not be
considered representative of the opinions or policies of my employer,
MacPlay, a division of Interplay Productions, Inc.
+++++++++++++++++++++++++++
>From peter@mail.peter.com.au (Peter N Lewis)
Date: Thu, 23 Mar 1995 16:37:31 +0800
Organization: Curtin University
In article <cconstan-1703950752490001@epdso1.env.gov.bc.ca>,
cconstan@airux1.env.gov.bc.ca (Carl B. Constantine) wrote:
>Ok, I'll bite. How do you know when to call it in these situations (ie: 5
>or 15 or 60 ticks, etc). Generally speaking a program is set up such that
>it calls WNE in the main loop, processes it and comes back and calls it
>again. How do you know how many ticks have gone by the next time WNE is
>called?
I'm not sure exactly what your question is. But I'll try again :-)
The sleep time in the WNE call is basically how long your application is
willing to wait until it WNE returns unless an event is in the OS queue
(or the mouse moves outside the specified region). Thus the sleep time
you use depends on what you are waiting for. If you application has
nothing to do and is waiting solely for user input, then you can call WNE
with a large sleep time. If all your app has to do is track the cursor
(to set the IBeam/Arrow for example), then you use a large sleep time and
a mouse region. If you are waiting on other events that wont come thru
the WNE event queue (such as polled asyncronous commands, TCP/ADSP etc
connections), then you need to have a sufficiently low sleep time that you
can respond quickly to those events. If you are actively processing (eg
calculating mandlebrots or whatever), then you should always have a sleep
time of 0. In this last case, you should control how much time you take
up by doing less work between calls to WNE when you are in teh backgroun,
and more work when you are the foreground app. For example, you might
calculate one line in your madlebrot set if you are in the background, and
10 if you are in the foreground, eg:
while not quitNow do begin
WNE
ProcessEvents
if inforground then
CalculateLines(10)
else
CalculateLines(1)
end-if
end-while
Or better yet, you might calculate for 1 tick if you are in the
background, and 5 ticks in the foreground.
So basically, you have a sleep time of 0 if you are actively doing some
processing. And a sleep time of 5-15 if you are idle, but have to respond
to events that don't come thru the event loop, and a sleep time of 120 if
you respond only to user events.
Enjoy,
Peter.
--
The best movie I've seen recently is "Heavenly Creatures" from New Zealand
+++++++++++++++++++++++++++
>From grobbins@znet.com (Grobbins)
Date: Sun, 19 Mar 1995 13:20:25 -0700
Organization: zNET
In article <cconstan-1703950752490001@epdso1.env.gov.bc.ca>,
cconstan@airux1.env.gov.bc.ca (Carl B. Constantine) wrote:
>How do you know how many ticks have gone by the next time WNE is called?
Call TickCount to see if a sufficient interval since the last call to WNE
has elapsed. If your app is in the foreground and is busy doing work or
animating, an interval of five or ten ticks between calls to WNE is
reasonable. If an app is in the background or is not really busy, do not
impose any interval between WNE calls, and use the largest sleep time
necessary to give the app adequate null events (typically GetCaretTime()
for apps flashing a cursor and a large number, like 5000, for apps not
doing anything other than waiting for user or high-level events.)
Grobbins grobbins@znet.com
+++++++++++++++++++++++++++
>From ericd@netcom.com (Eric Drumbor)
Date: Wed, 29 Mar 1995 14:02:00 GMT
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Chris De Salvo (phixus@deltanet.com) wrote:
: In article <3kk9ed$l34@maverick.tad.eds.com>, msmwhq01.rharve01@eds.com
: (Richard Harvey) wrote:
: > In article <cconstan-1703950752490001@epdso1.env.gov.bc.ca>
: > cconstan@airux1.env.gov.bc.ca (Carl B. Constantine) writes:
: >
: > > Ok, I'll bite. How do you know when to call it in these situations (ie: 5
: > > or 15 or 60 ticks, etc). Generally speaking a program is set up such that
: > > it calls WNE in the main loop, processes it and comes back and calls it
: > > again. How do you know how many ticks have gone by the next time WNE is
: > > called?
: >
: > Well, I'd recommend setting up a Time Manager task that is called at
: > whatever interval you need to call WNE at. You can then have it set a
: > global Boolean that you can check in your main loop to see if it is
: > time to call WNE. If it is, set it back to false and wait for the next
: > pass.
: Depends on the game. If you're writing a bridge game, or checkers, by all
: means, use a normal event loop. If you're writing a
: massively-speed-critical arcade thriller then screw the event loop. Take
: over the whole machine. Read the mouse directly, read the keyboard
: directly, ignore all other applications. you're a game, you're allowed.
: If you do use an event loop then Apple recommends check the double-click
: time with GetDoubleTime and calling WNE at least that often. One thing
: that a lot of people do is to use GetOSEvent the majority of the time for
: speed's sake and then call WNE about every 60th of a second for
: friendliness' sake. GetOSEvent will let you have a crack at keyboard and
: mouse events before the rest of the system. Save a lot of time.
What about network play? I'm just starting to read up on using
AppleTalk (to use with my next game), but I'm just wondering how these
practices would effect a network session? Would WNE need to be called
more often because of this, or would this kind of loop (calling GetOSEvt
and calling WNE once every 60 ticks) work peachy with net games? Also,
how about serial connections?
--
"Joseph Stalin, take hold of my armored mumu and we shall leave this place."
Eric A. Drumbor
BW Software
ericd@netcom.com
formerly Malicious_Monarch@nile.com
+++++++++++++++++++++++++++
>From tyger@halcyon.com (Chris Todd)
Date: Thu, 30 Mar 1995 19:05:10 -0800
Organization: Tyger Soft
In article <ericdD67GBC.7Kv@netcom.com>, ericd@netcom.com (Eric Drumbor) wrote:
-> What about network play? I'm just starting to read up on using
-> AppleTalk (to use with my next game), but I'm just wondering how these
-> practices would effect a network session? Would WNE need to be called
-> more often because of this, or would this kind of loop (calling GetOSEvt
-> and calling WNE once every 60 ticks) work peachy with net games? Also,
-> how about serial connections?
Keep reading up... most of the apple talk stuff (depending on the
protocol) can be done Async, so you get to decide when you wany to look at
what gets sent to you, and theEvent stuff isn't even a concern :-)...
--
Chris Todd
tyger@halcyon.com
+++++++++++++++++++++++++++
>From sandvik@apple.com (Kent Sandvik)
Date: Sun, 02 Apr 1995 17:54:58 -0800
Organization: Apple Computer, Inc. Developer Technical Support
> In article <ericdD67GBC.7Kv@netcom.com>, ericd@netcom.com (Eric Drumbor)
wrote:
>
> -> What about network play? I'm just starting to read up on using
> -> AppleTalk (to use with my next game), but I'm just wondering how these
> -> practices would effect a network session? Would WNE need to be called
> -> more often because of this, or would this kind of loop (calling GetOSEvt
> -> and calling WNE once every 60 ticks) work peachy with net games? Also,
> -> how about serial connections?
Call WNE (or EventAvail) once a minute, and the network connections should
still be alive.
--Kent
--
Kent Sandvik sandvik@apple.com Working with Multimedia stuff...
Apple Developer Technical Support. Private activities on Internet.
---------------------------
>From english@primenet.com (Lawson English)
Subject: FYI QuickTime 2.0 Dev Guide for Macintosh on Internet (ftp)
Date: 7 Apr 1995 22:34:29 GMT
Organization: Primenet
Date: Wed, 5 Apr 1995 14:13:51 -0700
From: Kent Sandvik <sandvik@apple.com>
To: Multiple recipients of list <quicktime-dev@abs.apple.com>
Subject: FYI QuickTime 2.0 Dev Guide for Macintosh on Internet (ftp)
[Feel free to forward this info to whoever needs it, even better, ask them
to subscribe to this mailing list in order to get latest developer
information concerning QuickTime].
The QuickTime 2.0 Developer Guide for Macintosh is now available on ftp:
URL:
ftp://ftp.info.apple.com/dts/quicktime/QT_MAC.PDF.hqx
This document has information about the new music architecture of QT 2.0,
data handlers, additional APIs in the movie toolbox and in general what's
new in QT 2.0. This is an Acrobat file (stuffit/binhex, 812k), so you need
the latest Acrobat reader as well.
There's a small chance this document might move to another location, if so
I will inform. Meanwhile, this would help those who subscribe to the OS SDK
CDs, and didn't receive this info on the #2 CD (and should be available on
#3), or anyone else who wants to do programming using the new QT 2.0
features.
--Kent
- -
Kent Sandvik sandvik@apple.com DTS Engineer, Apple.
--
- -----------------------------------------------------------------------------
Lawson English __ __ ____ ___ ___ ____
english@primenet.com /__)/__) / / / / /_ /\ / /_ /
/ / \ / / / / /__ / \/ /___ /
- -----------------------------------------------------------------------------
---------------------------
>From Said Kobeissi <said.kobeissi@together.org>
Subject: File manipulation??
Date: 6 Apr 1995 15:25:46 GMT
Organization: TOGETHER INTERNET SERVICES
Hi everyone,
I am just learning some macintosh file stuff, and have run across a
problem. I am writing a preferences file for my application, and am
lost trying to find out what routines to use. Currently, I use
FindFolder to find the Preferences folder ID. I then try to use FSOpen
with my filename, the returned directory ID, and a pointer for the
returned file reference number. However, FSOpen seems to want a
directory reference number rather than a directory ID. How do I convert
a directory Id to a directory reference number? Or am I going about this
completely the wrong way? I understand I could put the path in FSOpen,
but since it might vary from computer to computer, I want to make it
flexible enough to work on any machine. I guess its a really simple
question, does anyone have a code snippet that opens a preference file
given only the filename (and knowledge that the file is in the
preferences folder), and reads a string/whatever from it. Thanks for
reading this long tedious letter, and thanks for giving me any help you
can. =)
Said
tai@together.net
http://together.net/~tai/
+++++++++++++++++++++++++++
>From Anders.Wahlin@hum.gu.se (Anders Wahlin)
Date: Fri, 7 Apr 1995 12:41:26 GMT
Organization: Hum Fak:s Dataservice
In article <3m115q$24v@bristlecone.together.net>, Said Kobeissi
<said.kobeissi@together.org> wrote:
> Hi everyone,
>
> I am just learning some macintosh file stuff, and have run across a
> problem. I am writing a preferences file for my application, and am
> lost trying to find out what routines to use. Currently, I use
> FindFolder to find the Preferences folder ID. I then try to use FSOpen
> with my filename, the returned directory ID, and a pointer for the
> returned file reference number. However, FSOpen seems to want a
> directory reference number rather than a directory ID. How do I convert
> a directory Id to a directory reference number? Or am I going about this
> completely the wrong way? I understand I could put the path in FSOpen,
> but since it might vary from computer to computer, I want to make it
> flexible enough to work on any machine. I guess its a really simple
> question, does anyone have a code snippet that opens a preference file
> given only the filename (and knowledge that the file is in the
> preferences folder), and reads a string/whatever from it. Thanks for
> reading this long tedious letter, and thanks for giving me any help you
> can. =)
>
Make a FSSpec of the preference file. Then make use of the FSpxxxx
functions. Like this:
void HandleMyPrefFile(void) {
OSErr theErr;
short fileRefNum;
theErr = OpenMyPrefFile("\pName of pref file", &fileRefNum);
if (theErr != noErr){
/* Handle the error */
}
...
...
...
...
}
OSErr OpenMyPrefFile(Str255 prefFileName, short *prefFRefNum) {
OSErr theErr;
FSSpec theSpec;
short fRefNum;
theErr = GetPrefFileSpec(prefFileName, &theSpec);
if (theErr != noErr) return (theErr);
/* If your preferences is stored in a data file:
theErr = FSpOpenDF(&theSpec, fsRdWrPerm, &fRefNum);
if (theErr != noErr) return (theErr);
*prefFrefNum = fRefNum;
*/
/* If your preferences is stored in a resource file:
fRefNum = FSpOpenResFile(&theSpec, fsRdWrPerm);
if (ResError() != noErr) return (ResError());
*prefFrefNum = fRefNum;
*/
}
OSErr GetPrefFileSpec(Str255 fileName, FSSpec *theSpec) {
OSErr theErr;
short foundVRefNum;
long foundDirID;
FSSpec tempSpec;
theErr = FindFolder(kOnSystemDisk, 'pref', kDontCreateFolder,
&foundVRefNum, &foundDirID);
if (theErr != noErr) return (theErr);
theErr = FSMakeFSSpec(foundVRefNum, foundDirID, fileName, &tempSpec);
if (theErr == -43) {
/* The file is not found. Maby you want to create a new one? */
}
else if (theErr != noErr) return (theErr);
*theSpec = tempSpec;
return (noErr);
}
I hope that this will give you a clue. Good Luck.
--
Anders Wahlin
Anders.Wahlin@hum.gu.se
+++++++++++++++++++++++++++
>From skevill@tartarus.uwa.edu.au (Scott Kevill)
Date: 7 Apr 1995 15:38:04 GMT
Organization: The University of Western Australia
Said Kobeissi (said.kobeissi@together.org) wrote:
: Hi everyone,
: I am just learning some macintosh file stuff, and have run across a
: problem. I am writing a preferences file for my application, and am
: lost trying to find out what routines to use. Currently, I use
: FindFolder to find the Preferences folder ID. I then try to use FSOpen
: with my filename, the returned directory ID, and a pointer for the
: returned file reference number. However, FSOpen seems to want a
: directory reference number rather than a directory ID. How do I convert
: a directory Id to a directory reference number? Or am I going about this
: completely the wrong way? I understand I could put the path in FSOpen,
: but since it might vary from computer to computer, I want to make it
: flexible enough to work on any machine. I guess its a really simple
: question, does anyone have a code snippet that opens a preference file
: given only the filename (and knowledge that the file is in the
: preferences folder), and reads a string/whatever from it. Thanks for
: reading this long tedious letter, and thanks for giving me any help you
: can. =)
: Said
: tai@together.net
: http://together.net/~tai/
Don't use FSOpen. Rather, use HOpen or HOpenDF. These calls both take a
filename, a directory ID, and a volume reference number. The filename you
already have, and the other parameters you get from FindFolder. Although
these two calls were introduced with System 7, the glue code in the
compiler will do the job on earlier systems, just like it does for
FindFolder.
Personally, I wouldn't use the data fork for preferences, I would save
them as resources in the file (and use HOpenResFile). That makes it easier
for the application to manage them and easier for the user to edit them by
hand if they want to (and if templates are provided).
Hope this helps.
Scott Kevill
skevill@tartarus.uwa.edu.au
---------------------------
>From chad@xmission.com (Chad Leigh)
Subject: Macintosh Drag and Drop
Date: Tue, 04 Apr 1995 16:37:05 -0600
Organization: Pengar Enterprises / Amazing Master Autofax
Hi
Is there any "documentation" for this? I have the headers, the
extensions, etc. But where is the documentation on how to use this --
what calls do what, etc. I don't want to decipher .h files. I looked
around the apple WWW stuff and didn't find anything.
Thanks
Chad
- ------------------ Live Free or Die ! ---------------------------
Chad Leigh | When Guns are Outlawed, Criminals Win!
chad@xmission.com | Vote Libertarian! 1-800-682-1776
Ask about Amazing Master Autofax -- automated fax on demand services
for your business! (also custom telephony-voice/fax hw/sw solutions)
Also Quality ROBOTECH PCs at discount -- Bicom Voice Boards
--Thanks to the Df8 Supporters!----- Don't Tread on Me! -------------
+++++++++++++++++++++++++++
>From blm@chinook.halcyon.com (Brian L. Matthews)
Date: 5 Apr 1995 00:43:29 GMT
Organization: NW NEXUS, Inc. -- Internet Made Easy (206) 455-3505
In article <chad-0404951637050001@slc58.xmission.com>,
Chad Leigh <chad@xmission.com> wrote:
|Is there any "documentation" for this?
The manuals should have been included in the same place you got the
headers, but if they weren't, grab:
http://ftp.support.apple.com/pub/Apple SW Updates/US/Macintosh/System Software/Other System Software/Mac Drag and Drop (1.1).hqx
http://ftp.support.apple.com/pub/Apple SW Updates/US/Macintosh/System Software/Other System Software/Mac Drag and Drop (1.1).txt
Included in the package are documentation, a sample app with source code,
a couple of apps useful during testing, headers, and extensions.
Brian
+++++++++++++++++++++++++++
>From kevin@vailbox.washington.dc.us (Kevin Michael Vail)
Date: Tue, 04 Apr 1995 21:31:38 -0500
Organization: Vailhalla
In article <chad-0404951637050001@slc58.xmission.com>, chad@xmission.com
(Chad Leigh) wrote:
>Hi
>
>Is there any "documentation" for this? I have the headers, the
>extensions, etc. But where is the documentation on how to use this --
>what calls do what, etc. I don't want to decipher .h files. I looked
>around the apple WWW stuff and didn't find anything.
If you have the headers and the extensions, you should have the
documentation, too--it was all part of the same package. Documentation is
DocViewer files, I believe. If you got the headers, extensions, etc some
other way, then you need to get the whole developer's package from one of
the Apple sites.
--
Kevin Michael Vail | As a general rule, don't solve puzzles
kevin@vailbox.washington.dc.us | that open portals to Hell.
| -- A Horror Movie Character's Survival Guide
+++++++++++++++++++++++++++
>From chad@xmission.com (Chad Leigh)
Date: Wed, 05 Apr 1995 01:02:15 -0600
Organization: Pengar Enterprises / Amazing Master Autofax
In article <kevin-0404952131380001@vailbox.dgsys.com>,
kevin@vailbox.washington.dc.us (Kevin Michael Vail) wrote:
> In article <chad-0404951637050001@slc58.xmission.com>, chad@xmission.com
> (Chad Leigh) wrote:
>
> >Hi
> >
> >Is there any "documentation" for this? I have the headers, the
> >extensions, etc. But where is the documentation on how to use this --
> >what calls do what, etc. I don't want to decipher .h files. I looked
> >around the apple WWW stuff and didn't find anything.
>
> If you have the headers and the extensions, you should have the
> documentation, too--it was all part of the same package. Documentation is
> DocViewer files, I believe. If you got the headers, extensions, etc some
> other way, then you need to get the whole developer's package from one of
> the Apple sites.
> --
It was on the CW5 disk but just the examples and stuff. I found them
however on the Develop 16 CD. But thanks! I had looked all over until I
looked on old Develop CDs.
Best regards
Chad
- ------------------ Live Free or Die ! ---------------------------
Chad Leigh | When Guns are Outlawed, Criminals Win!
chad@xmission.com | Vote Libertarian! 1-800-682-1776
Ask about Amazing Master Autofax -- automated fax on demand services
for your business! (also custom telephony-voice/fax hw/sw solutions)
Also Quality ROBOTECH PCs at discount -- Bicom Voice Boards
--Thanks to the Df8 Supporters!----- Don't Tread on Me! -------------
+++++++++++++++++++++++++++
>From jumplong@aol.com (Jump Long)
Date: 7 Apr 1995 03:20:36 -0400
Organization: America Online, Inc. (1-800-827-6364)
>Is there any "documentation" for this? I have the headers, the
>extensions, etc. But where is the documentation on how to use this --
>what calls do what, etc. I don't want to decipher .h files. I looked
>around the apple WWW stuff and didn't find anything.
The Macintosh Drag and Drop SDK is on the Mac OS SDK CD along with just
about everything else that used to be a separate SDK from APDA.
- Jim Luther
---------------------------
>From lankton@spot.Colorado.EDU (LANKTON MARK)
Subject: No DriverInstall() ???
Date: 21 Mar 95 14:49:16 GMT
Organization: University of Colorado at Boulder
Now that the Universal Headers seem to include *neither* DriverInstall()
nor _DrvrInstall, just how is one supposed to install a custom driver,
anyway? I am trying to use a driver written in 68K in a PPC program,
which should (as I understand it) be an OK thing to do. I am familiar
with the traditional way of installing a driver on a 68K Mac, but how
are you supposed to do it if the xInstall() call is not available?
Puzzled and grumbling,
Mark Lankton (lankton@spot.colorado.edu)
Laboratory for Atmospheric and Space Physics
University of Colorado
+++++++++++++++++++++++++++
>From oster@netcom.com (David Phillip Oster)
Date: Sat, 25 Mar 1995 22:19:25 GMT
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
In article <lankton.795797356@spot.Colorado.EDU> lankton@spot.Colorado.EDU (LANKTON MARK) writes:
>
>Now that the Universal Headers seem to include *neither* DriverInstall()
>nor _DrvrInstall, just how is one supposed to install a custom driver,
>anyway?
Think Reference says:
pascal OSErr DrvrInstall(Handle dHandle, short refNum) =
{ 0x301F, 0x205F, 0x2050, 0xA03D, 0x3E80 }
i.e., this is a pascal protocol, stack based trap, which pushes
a handle, then a short. The trap number is 0xA03D. the 0x3E80
moves the return value from the stack to D0 (?)
This gives you enough info to GetTrapAddress(0xA03D) to get
a UPP, then call it with CallUniversalProc().
--
- ------- <mail-to:oster@netcom.com> ----------
Ahh! The thorazine is wearing off and the odinazine is coming on...
+++++++++++++++++++++++++++
>From jumplong@aol.com (Jump Long)
Date: 3 Apr 1995 02:07:59 -0400
Organization: America Online, Inc. (1-800-827-6364)
>Now that the Universal Headers seem to include *neither* DriverInstall()
>nor _DrvrInstall, just how is one supposed to install a custom driver,
>anyway? I am trying to use a driver written in 68K in a PPC program,
>which should (as I understand it) be an OK thing to do. I am familiar
>with the traditional way of installing a driver on a 68K Mac, but how
>are you supposed to do it if the xInstall() call is not available?
Mark, you don't really want to use DriverInstall anyway. It has always had
a bug and as far as I know, the bug has never been fixed (one field in the
drive queue element isn't filled in).
What you should use is the DriverInstall function in the DTS RAMDisk
sample. It does the same thing as the system version of the call, but
fixes the bug.
We're in the process of changing the RAMDisk driver to be a pointer-based
driver instead of a handle-based driver. You should make your drivers
pointer-based, too -- it will increase the drivers performance and will
get rid of the Device Manager's nasty calls to the Memory Manager that set
MemErr.
- Jim Luther
---------------------------
>From Said Kobeissi <said.kobeissi@together.org>
Subject: Saving check boxes?
Date: 4 Apr 1995 15:14:42 GMT
Organization: TOGETHER INTERNET SERVICES
Hi everyone,
Got a question about saving check boxes. I have a dialog box that has
some check boxes. I want to save the settings between runs of the
application. How does one write which boxes are set to the resource
file? I want to save them if the user presses done, and not save if the
user presses cancel. So I assume there is something I have to do in the
'donebutton' case, but I can't figure out what. I have tried the
following, but seem to be missing something:
ChangedResource(prefDlg);
if(!CheckOS(ResError()))
return FALSE;
UpdateResFile(CurResFile());
if(!CheckOS(ResError()))
return FALSE;
done = TRUE;
I click on done, and then when I choose that dialog box again, it still
doesn't have any boxes checked :( Can anyone help me? Thanks tons! =P
Said
tai@together.net
http://together.net/~tai/
+++++++++++++++++++++++++++
>From Francois-Regis.Degott@imag.fr (F. Degott)
Date: 4 Apr 1995 15:49:47 GMT
Organization: LMC-IMAG Grenoble France
In article <3lrnp2$f41@bristlecone.together.net>, Said Kobeissi
<said.kobeissi@together.org> wrote:
>
> ChangedResource(prefDlg);
> if(!CheckOS(ResError()))
> return FALSE;
> UpdateResFile(CurResFile());
> if(!CheckOS(ResError()))
> return FALSE;
> done = TRUE;
>
>
> I click on done, and then when I choose that dialog box again, it still
> doesn't have any boxes checked :( Can anyone help me? Thanks tons! =P
>
Hi Said,
i think that the state of the check boxes or radio buttons are not
described (or saved) in resource. Remark that, with resedit, it isn't possible
to predefine the state of these controls...
I think that it's up to you to save and read 'manually' the ctrl states
in your resource file.
Hope this helps.
Bye.
FR.
__________________________________________
F.R. Degott (Francois-Regis.Degott@imag.fr)
Lab. LMC-IMAG - Univ. Joseph Fourier - Grenoble - France
+++++++++++++++++++++++++++
>From kurisuto@babel.ling.upenn.edu (Sean Crist)
Date: 4 Apr 1995 16:28:48 GMT
Organization: University of Pennsylvania, Linguistics Department
In article <3lrnp2$f41@bristlecone.together.net>,
Said Kobeissi <said.kobeissi@together.org> wrote:
>Hi everyone,
>
> Got a question about saving check boxes. I have a dialog box that has
>some check boxes. I want to save the settings between runs of the
>application. How does one write which boxes are set to the resource
>file? I want to save them if the user presses done, and not save if the
>user presses cancel. So I assume there is something I have to do in the
>'donebutton' case, but I can't figure out what. I have tried the
>following, but seem to be missing something:
>
> ChangedResource(prefDlg);
> if(!CheckOS(ResError()))
> return FALSE;
> UpdateResFile(CurResFile());
> if(!CheckOS(ResError()))
> return FALSE;
> done = TRUE;
>
>
>I click on done, and then when I choose that dialog box again, it still
>doesn't have any boxes checked :( Can anyone help me? Thanks tons! =P
The representation of dialog items in the DITL is not the same as
their representation in memory when you open a dialog; when you open a
dialog, the Toolbox parses the DITL and uses that information to decide
when to call NewControl, etc. There's no place in the DITL to represent
the value of a control, so you can't store control values in a DITL.
But even if this were possible, I think it would be the wrong way to
approach the problem. User interface items (controls, menus, etc.) are
_not_ the place to store your data; they are just the interface between
your data and the user. For example, a checkbox represents a boolean value
(on or off). I think the right way to do this is to declare a boolean
variable where you keep track of this value. When the user clicks in the
control, you change the value of the boolean (and, of course, change the
value of the control). When you open the dialog to start with, look at the
value of your boolean and use it to set the value of the control correctly.
To rephrase your question, how can you save a boolean value? Well, one way
is to make your own private kind of resource that stores the values you
want to save. This is pretty easy to do, as long as you have a reasonable
understanding of how to use the resource manager: basically, you declare
whatever kind of record you want, make a handle to that record, and then
AddResource it (there's lots more, but it would be better just to read the
Resource Manager chapters of IM.)
\/ __ __ _\_ --Sean Crist (kurisuto@unagi.cis.upenn.edu)
--- | | \ / For a free copy of the Bill of Rights, finger
_| ,| ,| ----- this account.
_| ,| ,| [_] Q: What do Standard Oil, AT&T, and Microsoft have in
| | | [_] common? A: Nothing... yet.
+++++++++++++++++++++++++++
>From dstone@alchemy.chem.utoronto.ca (David Stone)
Date: Tue, 4 Apr 1995 16:24:58 GMT
Organization: University of Toronto Chemistry
In article <3lrnp2$f41@bristlecone.together.net>, Said Kobeissi
<said.kobeissi@together.org> wrote:
>
> Hi everyone,
>
> Got a question about saving check boxes. I have a dialog box that has
> some check boxes. I want to save the settings between runs of the
> application. How does one write which boxes are set to the resource
> file? I want to save them if the user presses done, and not save if the
> user presses cancel. So I assume there is something I have to do in the
> 'donebutton' case, but I can't figure out what. I have tried the
> following, but seem to be missing something:
>
> ChangedResource(prefDlg);
> if(!CheckOS(ResError()))
> return FALSE;
> UpdateResFile(CurResFile());
> if(!CheckOS(ResError()))
> return FALSE;
> done = TRUE;
>
>
> I click on done, and then when I choose that dialog box again, it still
> doesn't have any boxes checked :( Can anyone help me? Thanks tons! =P
>
> Said
>
> tai@together.net
> http://together.net/~tai/
Probably it doesn't touch the individual 'DITL' items - maybe just the
'DLOG' template?
I use Booleans to keep track of my checkboxes, allowing me to store
the settings in preferences files (that way, different users can maintain
their own settings..)
To set the checkbox before displaying the dialog, I get the item handle
from GetDItem and cast as a ControlHandle, then
SetCtlValue(cHndl,(isChecked ? 1 : 0));
where isChecked is my boolean. If the user leaves the dialog using
the cancel button or escape sequence (cmd-period etc) I do nothing,
otherwise I repeat the process and reset the boolean
isChecked = (GetCtlValue(cHdnl) == 1);
All my preference settings are further defined in structs to allow
easy reading/writing to files, updating to default settings etc.
Hope that helps!
Dave Stone
+++++++++++++++++++++++++++
>From woody@alumni.cco.caltech.edu (William Edward Woody)
Date: Tue, 04 Apr 1995 13:11:41 -0800
Organization: In Phase Consulting
In article <3lrnp2$f41@bristlecone.together.net>, Said Kobeissi
<said.kobeissi@together.org> wrote:
> Hi everyone,
>
> Got a question about saving check boxes. I have a dialog box that has
> some check boxes. I want to save the settings between runs of the
> application. How does one write which boxes are set to the resource
> file? I want to save them if the user presses done, and not save if the
> user presses cancel. So I assume there is something I have to do in the
> 'donebutton' case, but I can't figure out what. I have tried the
> following, but seem to be missing something:
>
> ChangedResource(prefDlg);
> if(!CheckOS(ResError()))
> return FALSE;
> UpdateResFile(CurResFile());
> if(!CheckOS(ResError()))
> return FALSE;
> done = TRUE;
You really don't want to save the settings in the resource fork of your
application.
You want to put that data into a preferences file, and put the preferences
file in the preferences folder of your system.
(For more information on locating the preferences folder, refer to the
function FindFolder in 'Inside Macintosh: Macintosh Toolbox Essentials,
pg 7-54.)
--
William Edward Woody | e-mail: woody@alumni.cco.caltech.edu
In Phase Consulting | WWW: http://alumni.caltech.edu/~woody
337 West California #4 | Fax: (818) 502-1467
Glendale, CA 91203 | ICBM: N:34.4' W:118.15'
---------------------------
>From pmold@netcom.com (Paul Moldenhauer)
Subject: What are the names of my serial ports? (CTB)
Date: Fri, 31 Mar 1995 20:32:33 GMT
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
I am writing an application that uses the Communications Toolbox. I am
configuring the Apple Modem Tool with a configuration string. At first I
assumed that the modem would be on the "Modem Port". Worked fine on most
of the Mac's, until I tried it on a Duo 280 with the internal express modem.
Turns out that the "Modem Port" doesn't appear to even exist. I see only a
"Printer/Modem Port" and an "Internal Modem".
Here's my question: How can I find out the name of the port to use?
I don't want the user to have to configure the Apple Modem Tool through the
CMChooser(). Basically, I need to know whether to use "Modem Port" or
"Internal Modem". I found a trap called ModemStatus() under the Power
manager, but it must not be implemented on non-portables because I get an
unimplimented trap error. I don't know the trap number, so I can't do a
NGetTrapAddress().
Any suggestions would be gladly excepted.
Paul Moldenhauer
pmold@netcom.com
+++++++++++++++++++++++++++
>From oster@netcom.com (David Phillip Oster)
Date: Mon, 3 Apr 1995 21:04:59 GMT
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
In article <pmoldD6BnqA.Aw1@netcom.com> pmold@netcom.com (Paul Moldenhauer) writes:
>I am writing an application that uses the Communications Toolbox. I am
>configuring the Apple Modem Tool with a configuration string. At first I
>assumed that the modem would be on the "Modem Port". Worked fine on most
>of the Mac's, until I tried it on a Duo 280 with the internal express modem.
>Turns out that the "Modem Port" doesn't appear to even exist. I see only a
>"Printer/Modem Port" and an "Internal Modem".
You should always ask the user what port to use. I have 2 4-port cards on
my nubus and I get so pissed off at products like
the Connectix eyeball camera or
the Miracle MIDI interface or
the X-10 CP290 home controller, or
the Kurta PenMouse tablet or
applelink
that insist on being on either the modem or the printer serial port..
Come on people! Hre is the code, again, for finding our what ports
exist:
/* main.c - Using Connection Resource Manager, print all the portnames.
*/
#include <stdio.h>
#include <CRMSerialDevices.h>
#include <CommResources.h>
#define Length(s) ((int) (s)[0])
main()
{
CRMRecPtr crp;
CRMRec crm;
CRMSerialPtr csp;
StringPtr s;
FILE *out;
InitCRM();
crm.qLink = NULL;
crm.qType = crmType;
crm.crmVersion = crmRecVersion;
crm.crmPrivate = 0;
crm.crmReserved = 0;
crm.crmDeviceType = crmSerialDevice;
crm.crmDeviceID = 0;
crm.crmAttributes = 0;
crm.crmStatus = 0;
crm.crmRefCon = 0;
crp = &crm;
if(NULL == (out = fopen("log", "w"))){
return -1;
}
while(NULL != (crp = CRMSearch(crp))){
if(NULL != (csp = (CRMSerialPtr) crp->crmAttributes)){
if(NULL != (s = *csp->inputDriverName)){
fprintf(out, "\"%.*s\"\n", Length(s), &s[1]);
}
if(NULL != (s = *csp->outputDriverName)){
fprintf(out, "\"%.*s\"\n", Length(s), &s[1]);
}
}
}
return 0;
}
--
- ------- <mail-to:oster@netcom.com> ----------
Ahh! The thorazine is wearing off and the odinazine is coming on...
---------------------------
End of C.S.M.P. Digest
**********************